<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            // 手写实现Object.create()
            let obj = {
                name: 'zs',
                age: 19,
            };
            let newObj = Object.create(obj);
            console.log(newObj);
            console.log(newObj.__proto__ == obj);
            console.dir(Object);
            Object.myCreate = (obj) => {
                function F() {}
                F.prototype = obj;
                return new F();
            };

            let newObj1 = Object.myCreate(obj);
            console.log(newObj1);
            console.log(newObj1.__proto__ == obj);
        </script>
    </body>
</html>
